﻿using Abp.AutoMapper;
using Abp.Collections.Extensions;
using Paas.Core.Approvals.Entities;
using Basefr.App.Dtos;
using System.Collections.Generic;
using System.Linq;

namespace Paas.App.Interface.Approvals.Dtos
{
    [AutoMap(typeof(ApproveTemplateStep))]
    public class ApproveTemplateStepDto : DtoBase
    {
        public int TemplateId { get; set; }

        public string Name { get; set; }

        public int SortIndex { get; set; }

        public bool OperateByInitiator { get; set; }

        public bool ChangeObjectState { get; set; }


        /// <summary>
        /// 下一步节点
        /// </summary>
        public int? NextId { get; set; }

        /// <summary>
        /// 角色
        /// </summary>
        public virtual List<ApproveTemplateStepOperatorDto> Operators { get; set; }

        [AutoMap(typeof(ApproveTemplateStepOperator))]
        public class ApproveTemplateStepOperatorDto
        {
            public int TemplateStepId { get; set; }

            public long OperatorId { get; set; }
            public string OperatorName { get; set; }
        }


        public string OperatorNames => Operators?.Select(r => r.OperatorName).JoinAsString("，");
    }
}

